/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun * Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.db.explorer.dlg; import java.util.ResourceBundle; import org.openide.util.NbBundle; /** * * @author jformanek * @version */ public class UnsupportedDatabaseDialog extends javax.swing.JDialog { public static final boolean RET_CANCEL = false; public static final boolean RET_OK = true; public static final int NONE = 0; public static final int GENERIC = 1; public static final int READONLY = 2; static final long serialVersionUID =5080997809878230203L; public UnsupportedDatabaseDialog() { this(new javax.swing.JFrame(), true); } /** Creates new form UnsupportedDatabaseDialog */ public UnsupportedDatabaseDialog(java.awt.Frame parent,boolean modal) { super (parent, modal); initComponents (); javax.swing.ButtonGroup group = new javax.swing.ButtonGroup(); group.add(genericButton); group.add(readonlyButton); readonlyButton.setSelected(true); setLocationRelativeTo(null); pack (); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents () {//GEN-BEGIN:initComponents buttonPanel = new javax.swing.JPanel (); okButton = new javax.swing.JButton (); cancelButton = new javax.swing.JButton (); jPanel1 = new javax.swing.JPanel (); jTextPane1 = new javax.swing.JTextPane (); genericButton = new javax.swing.JRadioButton (); jTextPane2 = new javax.swing.JTextPane (); readonlyButton = new javax.swing.JRadioButton (); jTextPane3 = new javax.swing.JTextPane (); jPanel2 = new javax.swing.JPanel (); setTitle ("Database is not supported by the system"); setResizable (false); addWindowListener (new java.awt.event.WindowAdapter () { public void windowClosing (java.awt.event.WindowEvent evt) { closeDialog (evt); } } ); buttonPanel.setLayout (new java.awt.FlowLayout (2, 5, 5)); okButton.setText ("OK"); okButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { okButtonActionPerformed (evt); } } ); buttonPanel.add (okButton); cancelButton.setText ("Cancel"); cancelButton.addActionListener (new java.awt.event.ActionListener () { public void actionPerformed (java.awt.event.ActionEvent evt) { cancelButtonActionPerformed (evt); } } ); buttonPanel.add (cancelButton); getContentPane ().add (buttonPanel, java.awt.BorderLayout.SOUTH); jPanel1.setLayout (new java.awt.GridBagLayout ()); java.awt.GridBagConstraints gridBagConstraints1; jPanel1.setPreferredSize (new java.awt.Dimension(350, 200)); jTextPane1.setEditable (false); jTextPane1.setFont (new java.awt.Font ("Serif", 0, 12)); jTextPane1.setText ("This database is not supported by the system. The following options are available:"); jTextPane1.setBackground ((java.awt.Color) javax.swing.UIManager.getDefaults ().get ("Button.background")); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridy = 0; gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.insets = new java.awt.Insets (10, 10, 0, 10); gridBagConstraints1.weightx = 1.0; jPanel1.add (jTextPane1, gridBagConstraints1); genericButton.setText ("Connect as generic database system"); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridy = 1; gridBagConstraints1.insets = new java.awt.Insets (15, 10, 0, 10); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; jPanel1.add (genericButton, gridBagConstraints1); jTextPane2.setFont (new java.awt.Font ("Serif", 0, 12)); jTextPane2.setText ("Connect to the database and use SQL-92 standard commands (not supported by all databases)."); jTextPane2.setBackground ((java.awt.Color) javax.swing.UIManager.getDefaults ().get ("Button.background")); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridy = 2; gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.insets = new java.awt.Insets (0, 10, 0, 10); gridBagConstraints1.weightx = 1.0; jPanel1.add (jTextPane2, gridBagConstraints1); readonlyButton.setText ("Connect in read-only mode"); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridy = 3; gridBagConstraints1.insets = new java.awt.Insets (10, 10, 0, 10); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; jPanel1.add (readonlyButton, gridBagConstraints1); jTextPane3.setFont (new java.awt.Font ("Serif", 0, 12)); jTextPane3.setText ("Connect without the ability to modify the database."); jTextPane3.setBackground ((java.awt.Color) javax.swing.UIManager.getDefaults ().get ("Button.background")); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridy = 4; gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints1.insets = new java.awt.Insets (0, 10, 0, 10); gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints1.weightx = 1.0; jPanel1.add (jTextPane3, gridBagConstraints1); gridBagConstraints1 = new java.awt.GridBagConstraints (); gridBagConstraints1.gridy = 5; gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints1.insets = new java.awt.Insets (5, 10, 5, 10); gridBagConstraints1.weightx = 1.0; gridBagConstraints1.weighty = 1.0; jPanel1.add (jPanel2, gridBagConstraints1); getContentPane ().add (jPanel1, java.awt.BorderLayout.CENTER); }//GEN-END:initComponents private void okButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed doClose (RET_OK); }//GEN-LAST:event_okButtonActionPerformed private void cancelButtonActionPerformed (java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed doClose (RET_CANCEL); }//GEN-LAST:event_cancelButtonActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog doClose (RET_CANCEL); }//GEN-LAST:event_closeDialog private void doClose (boolean retStatus) { returnStatus = retStatus; setVisible (false); dispose (); } public void run() { show(); } public int getResult() { if (returnStatus == false) return NONE; if (genericButton.isSelected()) return GENERIC; return READONLY; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel buttonPanel; private javax.swing.JButton okButton; private javax.swing.JButton cancelButton; private javax.swing.JPanel jPanel1; private javax.swing.JTextPane jTextPane1; private javax.swing.JRadioButton genericButton; private javax.swing.JTextPane jTextPane2; private javax.swing.JRadioButton readonlyButton; private javax.swing.JTextPane jTextPane3; private javax.swing.JPanel jPanel2; // End of variables declaration//GEN-END:variables private boolean returnStatus = RET_CANCEL; } /* * <<Log>> * 5 Gandalf 1.4 1/27/00 Radko Najman new version * 4 Gandalf 1.3 11/27/99 Patrik Knakal * 3 Gandalf 1.2 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun * Microsystems Copyright in File Comment * 2 Gandalf 1.1 9/13/99 Slavek Psenicka * 1 Gandalf 1.0 9/2/99 Slavek Psenicka * $ */